/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Emmanuel
 */
@Entity
@Table(name = "contentpage", catalog = "bloodhound", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contentpage.findAll", query = "SELECT c FROM Contentpage c"),
    @NamedQuery(name = "Contentpage.findById", query = "SELECT c FROM Contentpage c WHERE c.id = :id"),
    @NamedQuery(name = "Contentpage.findByUrl", query = "SELECT c FROM Contentpage c WHERE c.url = :url"),
    @NamedQuery(name = "Contentpage.findByCantLink", query = "SELECT c FROM Contentpage c WHERE c.cantLink = :cantLink")})
public class Contentpage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Size(max = 200)
    @Column(name = "url")
    private String url;
    @Column(name = "cantLink")
    private Integer cantLink;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "contentpage")
    private List<Post> postList;

    public Contentpage() {
    }

    public Contentpage(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getCantLink() {
        return cantLink;
    }

    public void setCantLink(Integer cantLink) {
        this.cantLink = cantLink;
    }

    @XmlTransient
    public List<Post> getPostList() {
        return postList;
    }

    public void setPostList(List<Post> postList) {
        this.postList = postList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contentpage)) {
            return false;
        }
        Contentpage other = (Contentpage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Contentpage[ id=" + id + " ]";
    }
    
}
